
import 'package:baselib/util/shared_preferences_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:baselib/base/base_widget.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_app/home/home_page.dart';
import 'package:flutter_app/mine/mine_page.dart';
import 'package:flutter_app/order/order_page.dart';
import 'package:flutter_app/util/colours.dart';
import 'package:flutter_app/util/urls.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:get/get.dart';
import 'package:baselib/util/common_utils.dart';
import 'package:baselib/util/commonponet.dart' as rxdart;
import 'package:popup_windows/popup_windows.dart';
import 'package:baselib/base/login_out_event.dart';
import 'controller/SplashControl.dart';
import 'package:event_bus/event_bus.dart';
import 'package:baselib/util/common_apiservice.dart';
class SplashPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return new SplashState();
  }
}

class SplashState extends State<SplashPage>
    with SingleTickerProviderStateMixin {
  final tabs = ["首页", "在线下单", "我的订单"];
  final maps=["个人中心", "交易记录", "账单管理","待核销金额","优惠券"];
  GlobalKey headKey = GlobalKey();
  TabController tabController;
  final SpalshController control = Get.put(SpalshController());

  @override
  Widget build(BuildContext context) {
    return getNormalPage(
        child: Container(
            child: Column(children: [
      buildTopView(),
      Expanded(
          child: Container(
               child: Scrollbar(
                 child: ListView(
                   children: [
                     Obx(()=>
                     (control.personType.value==0?(control.isLogin.value?buildTabView():
                     (control.tabIndex.value==0?buildTabView():buildNoLoginView())
                     ): MinePage(control.personType.value))
                     ),
                     buildBottom()],
                 ),
               ),
      ))
    ])));
  }

  ///头部
  Widget buildTopView() {
    return Container(
      height: 74,
      child: Row(
        children: [
          Spacer(
            flex: 2,
          ),
          Image.asset(
            CommonUtils.getImgPath("logo.png"),
            height: 73,
          ),
          Spacer(
            flex: 2,
          ),
          buildTabBar(),
          Spacer(
            flex: 1,
          ),
          Obx(()=>control.isLogin.value?buildLoginInfo():buildLoginBtns()),
          Spacer(
            flex: 1,
          ),
        ],
      ),
    );
  }

  ///登录信息
  Widget buildLoginInfo(){
    return Row(
      children: [
        Container(
          width: 35,
          child:PopupWindowWidget(
              intelligentConversion: false,
              direction: Direction.Bottom,
              child:  Image.asset(
                CommonUtils.getImgPath("head.png"),
                key: headKey,
                height: 30,
              ),
              showChild: Container(
                  height: 260,
                  decoration: BoxDecoration(
                      image: DecorationImage(
                          image: AssetImage(CommonUtils.getImgPath("pop_bg.png"))
                      )
                  ),
                  child: Column(
                    children: [
                      SizedBox(height: 10,),
                      Column(
                        children: maps.map((e) => InkWell(
                          onTap: (){
                            //["个人中心", "交易记录", "账单管理","待核销金额","优惠券"]
                            if(e=="个人中心")
                              control.personType.value=1;
                            else if(e=="交易记录")
                              control.personType.value=2;
                            else if(e=="账单管理")
                              control.personType.value=3;
                            else if(e=="待核销金额")
                              control.personType.value=4;
                            else if(e=="优惠券")
                              control.personType.value=5;
                            Navigator.pop(context);
                          },
                          child: Container(
                            alignment: Alignment.center,
                            height: 50,
                            child: Text(
                                e,style: TextStyle(color: Color(0xff2E2F33))
                            ),
                          ),
                        )).toList(),
                      ),
                    ],
                  )
              )
          ),
        ),
        // InkWell(
        //   onTap: (){
        //     control.showInfoMenu(context,headKey);
        //   },
        //   child:  Image.asset(
        //     CommonUtils.getImgPath("head.png"),
        //     key: headKey,
        //     height: 30,
        //   ),
        // ),
        Obx(()=>Text("欢迎你,${control.userLoginname}",style: TextStyle(color: ColourRes.app_262745, decoration: TextDecoration.none)),),
        SizedBox(
          width: 5,
        ),
        Text(
          "|",
          style: TextStyle(
              color: ColourRes.app_262745, decoration: TextDecoration.none),
        ),
        SizedBox(
          width: 5,
        ),
        GestureDetector(
          onTap: (){
            control.loginOut(context);
          },
          child: Text(
            "退出",
            style: TextStyle(
                color: ColourRes.app_262745, decoration: TextDecoration.none),
          ),
        ),
      ],
    );
  }

  ///登录注册
  Widget buildLoginBtns(){
    return Row(
      children: [
        GestureDetector(
          onTap: (){
            showDialog(context: context,barrierDismissible:false,
                builder: (ctx)=>control.buildLoginDialog());
          },
          child:  Text(
            "登录",
            style: TextStyle(
                color: ColourRes.app_262745, decoration: TextDecoration.none),
          ),
        ),
        SizedBox(
          width: 5,
        ),
        Text(
          "|",
          style: TextStyle(
              color: ColourRes.app_262745, decoration: TextDecoration.none),
        ),
        SizedBox(
          width: 5,
        ),
        Text(
          "注册",
          style: TextStyle(
              color: ColourRes.app_262745, decoration: TextDecoration.none),
        ),
      ],
    );
  }


  ///底部
  Widget buildBottom() {
    return Container(
      padding: EdgeInsets.only(top: 10, bottom: 10),
      alignment: Alignment.center,
      color: ColourRes.app_131532,
      child: Row(
        children: [
          Spacer(
            flex: 2,
          ),
          Container(
            alignment: Alignment.center,
            child: Column(
              children: [
                Row(
                  children: [
                    Text(
                      "首页",
                      style: TextStyle(
                          color: Colors.white, decoration: TextDecoration.none),
                    ),
                    SizedBox(
                      width: 75,
                    ),
                    Text(
                      "在线下单",
                      style: TextStyle(
                          color: Colors.white, decoration: TextDecoration.none),
                    ),
                    SizedBox(
                      width: 75,
                    ),
                    Text(
                      "我的订单",
                      style: TextStyle(
                          color: Colors.white, decoration: TextDecoration.none),
                    ),
                    SizedBox(
                      width: 75,
                    ),
                    Text(
                      "个人中心",
                      style: TextStyle(
                          color: Colors.white, decoration: TextDecoration.none),
                    ),
                    SizedBox(
                      width: 75,
                    ),
                    Text(
                      "联系客服",
                      style: TextStyle(
                          color: Colors.white, decoration: TextDecoration.none),
                    ),
                  ],
                ),
                SizedBox(
                  height: 10,
                ),
                Row(
                  children: [
                    Text(
                      "易车车@2012-2020塰鸥派科技有限公司",
                      style: TextStyle(
                          color: ColourRes.app_4D4E69,
                          decoration: TextDecoration.none),
                    ),
                    Image.asset(CommonUtils.getImgPath("guohui.png")),
                    Text(
                      "津公网安备12010002000002号 津ICP备15007503号-1",
                      style: TextStyle(
                          color: ColourRes.app_4D4E69,
                          decoration: TextDecoration.none),
                    ),
                  ],
                ),
              ],
            ),
          ),
          Spacer(
            flex: 1,
          ),
          Container(
            alignment: Alignment.center,
            child: Column(
              children: [
                Image.asset(
                  CommonUtils.getImgPath("wx.png"),
                  width: 90,
                ),
                SizedBox(
                  height: 15,
                ),
                Text(
                  "微信公众号",
                  style: TextStyle(
                      color: Colors.white, decoration: TextDecoration.none),
                ),
              ],
            ),
          ),
          SizedBox(
            width: 15,
          ),
          Container(
            alignment: Alignment.center,
            child: Column(
              children: [
                Image.asset(
                  CommonUtils.getImgPath("wx_s.png"),
                  width: 90,
                ),
                SizedBox(
                  height: 15,
                ),
                Text(
                  "小程序",
                  style: TextStyle(
                      color: Colors.white, decoration: TextDecoration.none),
                ),
              ],
            ),
          ),
          Spacer(
            flex: 2,
          ),
        ],
      ),
    );
  }

  ///tab
  Widget buildTabBar() {
    return Container(
      width: 500,
      height: 50,
      child: TabBar(
        tabs: tabs
            .map((e) => Tab(
                  text: e,
                ))
            .toList(),
        indicatorColor: ColourRes.app_1A4677,
        labelColor: ColourRes.app_1A4677,
        indicatorWeight: 1.0,
        labelStyle: TextStyle(fontSize: 20),
        unselectedLabelStyle: TextStyle(fontSize: 20),
        indicatorSize: TabBarIndicatorSize.label,
        unselectedLabelColor: ColourRes.app_262745,
        controller: tabController,
        onTap: (e){
          control.personType.value=0;
          control.tabIndex.value=tabController.index;
          print( "页码："+control.tabIndex.value.toString());
        },
      ),
    );
  }


  ///bannerView
  Widget buildBannerView(){
    var image=["https://pc-dev.haioupai.com/_nuxt/img/banner2.ca17147.png","https://pc-dev.haioupai.com/_nuxt/img/banner1.a9020b7.png"];
    return Swiper(
      // 横向
      scrollDirection: Axis.horizontal,
      // 布局构建
      itemBuilder: (BuildContext context, int index) {
       // return Image.asset(CommonUtils.getImgPath("home_banner.png"));
        return Image(image: NetworkImage(
          image[index]

        ),fit: BoxFit.fill,);
      },
      //条目个数
      itemCount: 2,
      // 自动翻页
      autoplay: true,
      // 分页指示
      pagination: SwiperPagination(alignment: Alignment.bottomCenter),
      //点击事件
      onTap: (index) {
        print(" 点击 " + index.toString());
      },
      // 相邻子条目视窗比例
      viewportFraction: 1,
      // 布局方式
      //layout: SwiperLayout.STACK,
      // 用户进行操作时停止自动翻页
      autoplayDisableOnInteraction: true,
      // 无线轮播
      loop: true,
      //当前条目的缩放比例
      scale: 1,
    );
  }


  ///tabview
  Widget buildTabView() {
    return Container(
      height: 2650,
        child: TabBarView(
      controller: tabController,
      children: [
        Column(
          children: [
            Container(
              height: 450,
              child:  buildBannerView(),
            ),
            Container(
                height: 750,
                color: Colors.white,
            child: buildHomeView1(),),
            Container(
              height: 1100,
              color: Color(0xfff4f4f4),
              child: buildHomeView2(),),
            Container(
              height: 350,
              color: Colors.white,
              child: buildHomeView3(),),
          ],
        ),
        Container(
          height: 1000,
          child: OrderPage(),
        ),
        Container(
          height: 200,
          child: Text("我的订单"),
        )
      ],
    ));
  }

  ///首页1
  Widget buildHomeView1(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                      shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Text("我们所能提供的服务",style: TextStyle(color: Color(0xff000000),fontSize: 30,fontWeight: FontWeight.w900),),
                Text("WHAT WE CAN OFFER",style: TextStyle(color: Color(0xff8f8f8f))),
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),

          ],
        ),
        SizedBox(height: 30,),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(CommonUtils.getImgPath("service-img1.png"),width: 350,),
                SizedBox(height: 25),
                Image.asset(CommonUtils.getImgPath("service-icon1.png")),
                SizedBox(height: 20),
                Text("货代揽收用车平台",style: TextStyle(color: Color(0xff000000),fontSize: 20),),
                SizedBox(height: 15),
                Text("定制用车服务专业揽收方案，时效快",style: TextStyle(color: Color(0xff8f8f8f))),
              ],
            ),
            SizedBox(width: 20,),
            Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(CommonUtils.getImgPath("service-icon2.png")),
                SizedBox(height: 20),
                Text("灵活用车服务",style: TextStyle(color: Color(0xff000000),fontSize: 20),),
                SizedBox(height: 15),
                Text("即时用车+计划用车,满足您多样用车需求",style: TextStyle(color: Color(0xff8f8f8f))),
                SizedBox(height: 25),
                Image.asset(CommonUtils.getImgPath("service-img2.png"),width: 350,),
              ],
            ),
            SizedBox(width: 20,),
            Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(CommonUtils.getImgPath("service-img3.png"),width: 350,),
                SizedBox(height: 25),
                Image.asset(CommonUtils.getImgPath("service-icon3.png")),
                SizedBox(height: 20),
                Text("运力托管服务",style: TextStyle(color: Color(0xff000000),fontSize: 20),),
                SizedBox(height: 15),
                Text("免费运力托管服务,订单和车辆统一线上\n智能化调度管理,提升1.5倍调度管理效率",style: TextStyle(color: Color(0xff8f8f8f)),),
              ],
            ),
          ],
        )
      ],
    );
  }

  ///首页2
  Widget buildHomeView2(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Text("为什么选择我们",style: TextStyle(color: Color(0xff000000),fontSize: 30,fontWeight: FontWeight.w900),),
                Text("WHY CHOOSE US",style: TextStyle(color: Color(0xff8f8f8f))),
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),
          ],
        ),
        SizedBox(height: 50,),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Image.asset(CommonUtils.getImgPath("choose-us1.png"),width: 550,),
            SizedBox(width: 50,),
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("choose-us-icon1.png"),width: 50,),
                    SizedBox(width: 10,),
                    Text("解决什么问题？",style: TextStyle(color: Color(0xff000000),fontSize: 30,)),
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Text("有效节省揽收环节财务成本、管理成本高？",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Text("揽收标准化、规范流程、提升效能",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Text("财务数据不清晰、货物信息、节点反馈、无信息化数据支持",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                  ],
                ),
              ],
            )
          ],
        ),
        SizedBox(height: 50,),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("choose-us-icon2.png"),width: 50,),
                    SizedBox(width: 10,),
                    Text("产品优势",style: TextStyle(color: Color(0xff000000),fontSize: 30,)),
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("极速响应",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("一键下单，全网调车；随叫随到，准时到达用车点",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("专业揽收",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("规范化的管理体系保证了专业的服务",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("智能路线",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("实时追踪车辆动态信息、路况信息",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("全程监控",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("实时订单状态，异常情况会警示",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("成本优势",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("用车节省成本30%起",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
                SizedBox(height: 20,),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisAlignment: MainAxisAlignment.start,
                  children: [
                    Image.asset(CommonUtils.getImgPath("quan.png"),width: 20,),
                    SizedBox(width: 20,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        Text("岗前培训",style: TextStyle(color: Color(0xff000000),fontSize: 20,)),
                        Text("司机上岗前都经过货代揽收专业化培训，并定期测试",style: TextStyle(color: Color(0xff8f8f8f),fontSize: 20,)),
                      ],
                    )
                  ],
                ),
              ],
            ),
            SizedBox(width: 50,),
            Image.asset(CommonUtils.getImgPath("choose-us2.png"),width: 550,),
          ],
        ),
      ],
    );
  }

  ///首页3
  Widget buildHomeView3(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SizedBox(height: 20,),
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Text("合作伙伴",style: TextStyle(color: Color(0xff000000),fontSize: 30,fontWeight: FontWeight.w900),),
                Text("COOPERATIVE PARTNER",style: TextStyle(color: Color(0xff8f8f8f))),
              ],
            ),
            SizedBox(width: 10,),
            Column(
              children: [
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  margin: EdgeInsets.only(left: 10),
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xff8f8f8f),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                ),
                SizedBox(height: 5,),
                Container(
                  width: 50,
                  height: 5,
                  decoration: BoxDecoration(
                    color:  Color(0xffcdcdcd),
                    shape: BoxShape.rectangle,
                    borderRadius:BorderRadius.circular(4),
                  ),
                )
              ],
            ),

          ],
        ),
        SizedBox(height: 30,),
        Row(
          children: [
            Spacer(),
            Column(
              children: [
                Image.asset(CommonUtils.getImgPath("feigao.png"),height: 100,),
                Text("深圳市飞高国际物流集团有限公司",style: TextStyle(color: Color(0xff000000),fontSize: 30),),
              ],
            ),
            Spacer(),
            Column(
              children: [
                Image.asset(CommonUtils.getImgPath("didadi.png"),height: 100,),
                Text("嘀嗒嘀物流科技有限公司",style: TextStyle(color: Color(0xff000000),fontSize: 30),),
              ],
            ),
            Spacer(),
            Column(
              children: [
                Image.asset(CommonUtils.getImgPath("jinghuada.png"),height: 100,),
                Text("深圳市京华达物流有限公司",style: TextStyle(color: Color(0xff000000),fontSize: 30),),
              ],
            ),
            Spacer(),
          ],
        )
      ],
    );
  }


  ///未登录状态
  Widget buildNoLoginView(){
    return Container(
      height: 800,
      color: Color(0xffF4F4F4),
      child: Center(
        child: Container(
            margin: EdgeInsets.only(top: 10,bottom: 10),
            color: Colors.white,
            width: 780,
            child: Column(
              children: [
                Image.asset(CommonUtils.getImgPath("login_no.png"),height: 200,),
                Text("登录后才可以访问",style:TextStyle(color: Color(0xff2E2F33)),),
                SizedBox(height: 10,),
                Container(
                  width: 150,
                  height: 50,
                  child: ElevatedButton(
                    child: Text("去登陆",
                        style: new TextStyle(
                            color: Colors.white, fontSize: 18)),
                    style: ButtonStyle(
                        backgroundColor:MaterialStateProperty.all(Color(0xff1A4677)),
                        shape: MaterialStateProperty.all(RoundedRectangleBorder(
                            borderRadius: BorderRadius.all(
                                Radius.circular(4))))
                    ),
                    onPressed: () {
                      showDialog(context: context,barrierDismissible:false,
                          builder: (ctx)=>control.buildLoginDialog());
                    },
                  ),
                )
              ],
            ),
        ),
      ),
    );
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    SchedulerBinding.instance.addPostFrameCallback((_) {
      //yourcode
      control.showKefuDialog(context);
    });

    tabController = TabController(length: tabs.length, vsync: this);
    tabController.addListener(() {
      control.personType.value=0;
      control.tabIndex.value=tabController.index;
      print( "页码："+control.tabIndex.value.toString());
    });

    CommonApiService.eventBus.on<LoginOutEvent>().listen((event) {
      // All events are of type UserLoggedInEvent (or subtypes of it).
      //print("退出登录");
      SharedPreferencesUtils().saveToken("");
      SharedPreferencesUtils().saveUsername("");
      control.isLogin.value=false;
      control.userLoginname.value="";
    });
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    tabController?.dispose();
  }
}
